package com.itheima.train.mapper;

import com.itheima.train.domain.CZYGroupDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CZYGroupMapper {
    @Select("SELECT "
            + "id,"
            + "name,"
            + "create_by "
            + "FROM czy_group "
            + "WHERE create_by=#{adminId}")
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "name", property = "name"),
            @Result(column = "create_by", property = "createBy"),
    })
    List<CZYGroupDO> findGroupListByAdminId(Long adminId);

    @Select({
            "select * from czy_group where create_by=#{adminId}"
    })
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "name", property = "name"),
            @Result(column = "create_by", property = "createBy"),
    })
    List<CZYGroupDO> findGroupListPage(Long adminId);
}
